 <template>
  <!--     查看职业监护标准 -->
  <div>
    <el-header style="position: relative; width: 100% ;height: 60px;" >
      <span>危害名称: {{searchHarmName}}</span>
      <el-divider direction="vertical"></el-divider>
      <span>在岗状态: <dict-tag :options="dict.type.dime_physical_work" :value="searchWorkStatus" style="display: inline-block" /></span>
<!--      <h3 style="display: inline-block">危害名称: {{searchHarmName}}</h3>-->
<!--      <h3 style="display: inline-block">在岗状态: <dict-tag :options="dict.type.dime_physical_work" :value="searchWorkStatus" style="display: inline-block" /></h3>-->
      <el-button type="info" @click="back">返回</el-button>
    </el-header>
    <el-container >
      <!--      左边菜单-->
        <el-menu
          style="width: 200px;height: 800px"
          background-color="#1F2D3E"
          text-color="rgb(191,203,217)"
          active-text-color="rgb(19,194,194)"
          :unique-opened="true"
          :router="true"
          :collapse-transition="false"
        >
          <el-menu-item
            class="el-menu-item"
            :index="'/searchbaseoccupationcriterion/'+item.path"  v-for="item in menuList" :key="item.id"
            :route="{name:item.path,query:{criterionId:searchId}}"
            >
            <template slot="title">
              <span>{{ item.name }}</span>
            </template>
          </el-menu-item>
        </el-menu>
      <!--      右边主体-->
      <el-main style="margin-top: -25px" >
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>
</template>
<script>
import {listBaseoccupationaldiseae} from "@/api/basic/baseoccupationaldiseae";
import {listBaseharm} from "@/api/basic/baseharm";
import {listBasecontraindication} from "@/api/basic/basecontraindication";
import {listBasecombcriterion} from "@/api/basic/basecombcriterion";

export default {
  name: "SearchCri",
  dicts:['dime_physical_work'],


  data() {
    return {
      menuList: [
        {id: 1, path: 'basecombcriterion', name: '监护标准对应项目'},
        {id: 2, path: 'basecontraindicationcriterion', name: '监护标准对应禁忌症'},
        {id: 3, path: 'baseoccupationaldiseasecriterion', name: '监护标准对应职业病'}
      ],
      searchId:{},
      searchHarmName:{},
      searchWorkStatus:{},
      activePath:{},

      queryParams: {
        pageNum: 1,
        pageSize: 5000,
        criterionId: null,
      },
    }

  },
  created() {
    this.getList();
  },
  mounted() {
    this.reset();
    this.getList();
  },
  methods:{
    getList(){
      this.getDate();
      listBaseoccupationaldiseae(
        this.queryParams).then(response => {
        this.baseoccupationaldiseaseList = response.rows;
        this.baseoccupationaldiseaseList.forEach(item => {
          item.key = item.id
          item.label = item.name
        })
      });
      listBasecontraindication(
        this.queryParams).then(response => {
        this.basecontraindicationList = response.rows;
        this.basecontraindicationList.forEach(item => {
          item.key = item.id
          item.label = item.name
        })
      });
      listBasecombcriterion(
        this.queryParams).then(response => {
        this.basecombcriterionList = response.rows;
      });
      listBaseharm({
        pageNum: 1,
        pageSize: 5000
      }).then(response => {
        this.baseharmList = response.rows;
      });
    },
    reset() {
      this.searchId = null;
      this.searchHarmName = null;
      this.searchWorkStatus = null;
    },
    getDate() {
      this.queryParams.criterionId = this.$route.query.id
      this.searchId = this.$route.query.id
      this.searchHarmName = this.$route.query.harmName
      this.searchWorkStatus = this.$route.query.workStatus
    },
    back() {
      const obj = { path: "/company/baseoccupationcriterion" };
      const comb = { path: "/searchbaseoccupationcriterion/basecombcriterion"};
      const cri = { path:  "/searchbaseoccupationcriterion/basecontraindicationcriterion"};
      const occ = { path:  "/searchbaseoccupationcriterion/baseoccupationaldiseasecriterion"};
      this.$tab.closePage(comb);
      this.$tab.closePage(cri);
      this.$tab.closePage(occ);
      this.$tab.closeOpenPage(obj);
    }
  }
}
</script>

